#pragma once

#include <string>

class Skill;
//卡牌类
class Card {
public:
    enum class CardPoint:char {
        None = 0,
        POINT_A,
        POINT_2,
        POINT_3,
        POINT_4,
        POINT_5,
        POINT_6,
        POINT_7,
        POINT_8,
        POINT_9,
        POINT_10,
        POINT_J,
        POINT_Q,
        POINT_K,
    };

    enum class CardColor: char {
        None = 0,
        PlumFlower,     //梅花
        SquarePiece,    //方片
        Spades,         //黑桃
        Hearts          //红桃
    };

    enum class Category: char {
        None = 0,
        Basic,  //基本O
        Tips,   //锦囊
        Equip   //装备
    };

    enum class Type:int32_t {
        None = 0,
        Kill = 1,           //杀
        Flash = 1 << 2,     //闪
        Peach = 1 << 3,     //桃
        Dismantle = 1 << 4, //过河拆桥
        Lead = 1 << 5,      //顺手牵羊
        Have = 1 << 6,      //无中生有
        Intrusion = 1 << 7, //南蛮入侵
        Duel = 1 << 8,      //决斗
        NoThinking = 1 << 9,//乐不思蜀
        NoSlack = 1 << 10,  //无懈可击
        Lightning = 1 << 11,//闪电
        Grains = 1 << 12,   //五谷丰登
        Borrow = 1 << 13,   //借刀杀人
        Arrow = 1 << 14,    //万箭齐发
        Junction = 1 << 15, //桃园结义
        Horse = 1 << 16,    //马
        Arms = 1 << 17,     //武器
        Armor = 1 << 18     //防具
    };

    static const char* getCardTypeStr(Type type) {
        switch (type) {
            case Type::Kill: return "杀";
            case Type::Flash: return "闪";
            case Type::Peach: return "桃";
            case Type::Dismantle: return "过河拆桥";
            case Type::Lead: return "顺手牵羊";
            case Type::Have: return "无中生有";
            case Type::Intrusion: return "南蛮入侵";
            case Type::Duel: return "决斗";
            case Type::NoThinking: return "乐不思蜀";
            case Type::NoSlack: return "无懈可击";
            case Type::Lightning: return "闪电";
            case Type::Grains: return "五谷丰登";
            case Type::Borrow: return "借刀杀人";
            case Type::Arrow: return "万箭齐发";
            case Type::Junction: return "桃园结义";
            case Type::Horse: return "马";
            case Type::Arms: return "武器";
            case Type::Armor: return "防具";
            default: return "未知类型牌";
        }
    }

    Card(CardPoint point, const char* name, const char* desc, CardColor color = CardColor::None, Category cate = Category::None, Type type = Type::None, Skill* skill = nullptr):
    point(point), name(name), desc(desc), color(color), cate(cate), type(type), oldType(Card::Type::None), skill(skill) {}
    CardPoint getPoint() const;
    const Card& setName(const char* x);
    const char* getName() const noexcept;
    const Card& setDesc(const char* x);
    const char* getDesc() const;
    const Card& setColor(CardColor c);
    CardColor getColor() const;
    const Card& setCate(Category c);
    Category getCate() const;
    const Card& setType(Type t);
    Type getType() const;
    const Card* cleanOldType();
    bool operator == (const Card& card) const;
private:
    CardPoint point;
    const char* name;
    const char* desc;
    CardColor color;
    Category cate;
    Type type;
    Type oldType;
    Skill* skill;
};